<div class="bjui-pageContent">
    <!-- 内容区 -->
    <form datagrids="userinfo" data-toggle="ajaxform">
            <label class="row-label">姓名</label>
            <div class="row-input">
                <input type="text"  id="userName">
            </div>
            <label class="row-label">性别</label>
            <div class="row-input">  <select id = "userSex",data-toggle="selectpicker" data-width="200">
                <option value="0">女</option>
                <option value="1">男</option>
            </select>
            </div>

            <label class="row-label">年龄</label>
            <div class="row-input"><input type="text" id="userAge"></div>

            <label class="row-label">联系方式</label>
            <div class="row-input"><input type="text" id="userMobile" ></div>

            <label class="row-label">邮箱</label>
            <div class="row-input"><input type="text" id="userEmail"></div>

            <label class="row-label">用户类型</label>
            <div class="row-input">  <select id = "userType",data-toggle="selectpicker" data-width="200">
                <option value="0">管理员</option>
                <option value="1">医师</option>
                <option value="2">护士</option>
                <option value="3">其他</option>
            </select></div>

            <label class="row-label">身份证号</label>
            <div class="row-input"><input type="text" id="userSfzid"></div>
        <div class="text-center">
            <button type="submit" class="btn-default" onclick="add()">提交表单</button>
        </div>
    </form>
<script>
    var type = 0,sex = 0;
    (function (){
        $('#userName').val(user.userData.userName);
        $('#userSex').val(user.userData.userSex);
        $('#userAge').val(user.userData.userAge);
        $('#userMobile').val(user.userData.userMobile);
        $('#userEmail').val(user.userData.userEmail);
        $('#userType').val(user.userData.userType);
        $('#userSfzid').val(user.userData.userSfzid);
    })();
    function add() {
        if ($('#userName').val() == "" || $('#userAge').val() == "" || $('#userMobile').val() == "" || $('#userEmail').val() == "" || $('#userSfzid').val() == "") {
            BJUI.alertmsg('info', '以上信息不能为空不能为空')
        } else {
            BJUI.ajax('doajax', {
                url: URL + 'updateSmUser.do',
                data: {
                    userId:user.userData.userId,
                    userName: $('#userName').val(),
                    userSex: sex,
                    userAge: $('#userAge').val(),
                    userMobile: $('#userMobile').val(),
                    userEmail: $('#userEmail').val(),
                    userType: type,
                    userSfzid: $('#userSfzid').val(),
                },
                loadingmask: true,
                okCallback: function (json, options) {
                    //刷新表格
                    $('#userTable').datagrid('refresh');
                }
            });
        }
    }

    $('#userType').on('change', function (e) {
        type=$(this).val();
    });

    $('#userSex').on('change', function (e) {
        sex=$(this).val();
    });

</script>

</div>
